package com.khh.controller;

import com.khh.dao.StuDao;
import com.khh.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by webrx on 2017-09-11.
 */
@Controller
public class StuController {

    @Autowired  //自动注入spring ioc 中的 studao
    private StuDao stu;

    /*@Autowired //自动注入spring ioc 中的 studentMapper  与dao中的冲突不能同时存在
    private StudentMapper sm;*/

    @RequestMapping("/test")
    public ModelAndView test(){
        ModelAndView mv = new ModelAndView("show");
        mv.addObject("student",stu.queryById(3));
        return mv;
    }

    /*@RequestMapping("/test1")
    public ModelAndView test1(){
        ModelAndView mv = new ModelAndView("show");
        mv.addObject("student",sm.queryById(3));
        return mv;
    }*/
}

